From 2f88aa3aa6074f0c2e51988758891d16e31c69ce Mon Sep 17 00:00:00 2001 From: Alastair Tse Date: Thu, 12 Oct 2006 12:30:01 +0100 Subject: [PATCH] [XEND] Fix interpretation of stringified 64 bit ints in XendConfig. Rename Xen API classes, "Host" and "Host_CPU" to their lowercase equivalent. Apparent confusion in the docs as to what they should be named. Signed-off-by: Alastair Tse --- tools/python/xen/xend/XendAPI.py | 14 +++++++------- tools/python/xen/xend/XendConfig.py | 19 ++++++++++++++++++- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/tools/python/xen/xend/XendAPI.py b/tools/python/xen/xend/XendAPI.py index 6f5df916d0..bcff07fc1a 100644 --- a/tools/python/xen/xend/XendAPI.py +++ b/tools/python/xen/xend/XendAPI.py @@ -208,8 +208,8 @@ class XendAPI: classes = { 'Session': (session_required,), - 'Host': (valid_host, session_required), - 'Host_CPU': (valid_host_cpu, session_required), + 'host': (valid_host, session_required), + 'host_cpu': (valid_host_cpu, session_required), 'VM': (valid_vm, session_required), 'VBD': (valid_vbd, session_required), 'VIF': (valid_vif, session_required)} @@ -346,19 +346,19 @@ class XendAPI: # Xen API: Class Host # ---------------------------------------------------------------- - Host_attr_ro = ['software_version', + host_attr_ro = ['software_version', 'resident_VMs', 'host_CPUs'] - Host_attr_rw = ['name_label', + host_attr_rw = ['name_label', 'name_description'] - Host_methods = ['disable', + host_methods = ['disable', 'enable', 'reboot', 'shutdown'] - Host_funcs = ['get_by_label'] + host_funcs = ['get_by_label'] # attributes def host_get_name_label(self, session, host_ref): @@ -412,7 +412,7 @@ class XendAPI: # Xen API: Class Host_CPU # ---------------------------------------------------------------- - Host_CPU_attr_ro = ['host', + host_cpu_attr_ro = ['host', 'number', 'features', 'utilisation'] diff --git a/tools/python/xen/xend/XendConfig.py b/tools/python/xen/xend/XendConfig.py index 8fbf9cbb23..84c91a4ee4 100644 --- a/tools/python/xen/xend/XendConfig.py +++ b/tools/python/xen/xend/XendConfig.py @@ -117,6 +117,20 @@ XENAPI_UNSUPPORTED_IN_LEGACY_CFG = [ 'otherconfig' ] +# configuration params that need to be converted to ints +# since the XMLRPC transport for Xen API does not use +# 32 bit ints but string representation of 64 bit ints. +XENAPI_INT_CFG = [ + 'user_version', + 'vcpus_number', + 'memory_static_min', + 'memory_static_max', + 'memory_dynamic_min', + 'memory_dynamic_max', + 'tpm_instance', + 'tpm_backend', +] + ## ## Xend Configuration Parameters ## @@ -563,7 +577,10 @@ class XendConfig(dict): for cfgkey, apikey in LEGACY_CFG_TO_XENAPI_CFG.items(): try: - cfg[cfgkey] = xenapi_vm[apikey] + if apikey in XENAPI_INT_CFG: + cfg[cfgkey] = int(xenapi_vm[apikey]) + else: + cfg[cfgkey] = xenapi_vm[apikey] except KeyError: pass -- 2.30.2